#pragma once

#include "EndGameDbCommon.h"

namespace EndGameDB
{
	// init function
	void InitBool();

	// 32-bit functions
	int LSB(uint32 x);
	int MSB(uint32 x);
	int RecBitCount(uint32 n);
	int BitCount(uint32 n);
	uint32 Revert(uint32 n);

	// 64-bit functions
	int LSB64(uint64 x);
	int MSB64(uint64 x);
	//uint64 Revert64(uint64 n);
	int BitCount64(uint64 n);

	 // template versions - switching between bitsize versions
	/////////////////////////////////////////////////////////////////////////////////////////////////////

	template<typename BB> int LSBxx(typename BB::value_type x);
	template<> int LSBxx<BitBoard>(typename BitBoard::value_type x);
	template<> int LSBxx<BitBoard64>(typename BitBoard64::value_type x);

	template<typename BB> int MSBxx(typename BB::value_type x);
	template<> int MSBxx<BitBoard>(typename BitBoard::value_type x);
	template<> int MSBxx<BitBoard64>(typename BitBoard64::value_type x);

	template<typename BB> int BitCountXX(typename BB::value_type x);
	template<> int BitCountXX<BitBoard>(typename BitBoard::value_type x);
	template<> int BitCountXX<BitBoard64>(typename BitBoard64::value_type x);

	template<typename BB> typename BB::value_type RevertXX(typename BB::value_type x);
	template<> typename BitBoard::value_type RevertXX<BitBoard>(typename BitBoard::value_type x);
	template<> typename BitBoard64::value_type RevertXX<BitBoard64>(typename BitBoard64::value_type x);

}